<?php

declare(strict_types=1);

namespace App\CustHub\Model;

use Mine\MineModel;

/**
 * @property int $id 
 * @property int $uid 
 * @property int $main_uid 
 * @property string $name 规则名称
 * @property int $corp_id 企业ID
 * @property int $status 状态：0=禁用 1=启用
 * @property int $type 方案类型
 * @property array $cfg 方案配置
 * @property int $is_default 是否默认方案
 * @property \Carbon\Carbon $created_at 创建时间
 * @property \Carbon\Carbon $updated_at 更新时间
 */
class ChOpScheme extends MineModel
{

    public const ENABLE =  1;

    public const DISABLE = 0;

    /**
     * The table associated with the model.
     */
    protected ?string $table = 'ch_op_scheme';

    /**
     * The attributes that are mass assignable.
     */
    protected array $fillable = ['id', 'uid', 'main_uid', 'name', 'corp_id', 'status', 'type', 'cfg', 'is_default', 'created_at', 'updated_at'];

    /**
     * The attributes that should be cast to native types.
     */
    protected array $casts = ['id' => 'integer', 'uid' => 'integer', 'main_uid' => 'integer', 'corp_id' => 'integer', 'status' => 'integer', 'type' => 'integer', 'cfg' => 'array', 'is_default' => 'integer', 'created_at' => 'datetime', 'updated_at' => 'datetime'];

    public function corp(): \Hyperf\Database\Model\Relations\HasOne
    {
        return $this->hasOne(ChCorp::class, 'id', 'corp_id');
    }
}
